package consume

import (
	"github.com/vueadmin/app/rabbitmq/internal/svc"
)

type Task struct {
	QueueName string                            //队列名称
	Fun       func(*svc.ServiceContext, string, int) //消费者执行方法
	Num       int                               //开启线程数量
}

// 消费者执行列表
var consumeList = []*Task{
	{QueueName: "demo", Num: 10, Fun: Demo},
}

// 注册消费队列
func RegisterConsume(svcCtx *svc.ServiceContext) {
	for _, val := range consumeList {
		for i := 0; i < val.Num; i++ {
			go val.Fun(svcCtx, val.QueueName, i)
		}
	}
}
